package data;

import com.EntityName;
import com.google.appengine.api.datastore.Entity;

public class BookingPolicy extends AbstractData {
	
	private long id = -1;
	private long hotelId;
	private String title;
	private boolean isDay;
	private String type;
	private boolean Percentcharge;
	private boolean fix;
	private boolean chargeNight;
	private double charge;
	private long beforeArrival;
	private boolean avalible;
	private boolean status;
	
	public BookingPolicy() {}
 
	public BookingPolicy( long id) {
		this.id = id;
	}
 
	public long getId() {
		return id;
	}
	
	public void setId(long id) {
		this.id = id;
	}

	public long getHotelId() {
		return hotelId;
	}

	public void setHotelId(long hotelId) {
		this.hotelId = hotelId;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public boolean isDay() {
		return isDay;
	}

	public void setDay(boolean isDay) {
		this.isDay = isDay;
	}

	public boolean isPercentcharge() {
		return Percentcharge;
	}

	public void setPercentcharge(boolean percentcharge) {
		Percentcharge = percentcharge;
	}

	public boolean isFix() {
		return fix;
	}

	public void setFix(boolean fix) {
		this.fix = fix;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public boolean isChargeNight() {
		return chargeNight;
	}

	public void setChargeNight(boolean chargeNight) {
		this.chargeNight = chargeNight;
	}

	public double getCharge() {
		return charge;
	}

	public void setCharge(double charge) {
		this.charge = charge;
	}

	public long getBeforeArrival() {
		return beforeArrival;
	}

	public void setBeforeArrival(long beforeArrival) {
		this.beforeArrival = beforeArrival;
	}

	public boolean isAvalible() {
		return avalible;
	}

	public void setAvalible(boolean avalible) {
		this.avalible = avalible;
	}

	public boolean isStatus() {
		return status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

@Override
public Entity getEntity() {

	Entity item;
	if(this.key == null)
		item = new Entity(EntityName.BookingPolicy);
	else
		item = new Entity(this.key);

	item.setProperty("hotelId", this.hotelId);
	item.setProperty("title", this.title);
	item.setProperty("isDay", this.isDay);
	item.setProperty("Percentcharge", this.Percentcharge);
	item.setProperty("fix", this.fix);
	item.setProperty("chargeNight", this.chargeNight);
	item.setProperty("type", this.type);
	item.setProperty("charge", this.charge);
	item.setProperty("beforeArrival", this.beforeArrival);
	item.setProperty("avalible", this.avalible);
	item.setProperty("status", this.status);
	return item;
	
}

@Override
public void setEntity(Entity entity) {
	this.id = entity.getKey().getId();
	this.hotelId = (Long) entity.getProperty("hotelId");
	this.title = (String) entity.getProperty("title");
	this.isDay = (Boolean) entity.getProperty("isDay");
	this.Percentcharge = (Boolean) entity.getProperty("Percentcharge");
	this.fix = (Boolean) entity.getProperty("fix");
	this.chargeNight = (Boolean) entity.getProperty("chargeNight");
	this.type = (String) entity.getProperty("type");
	this.charge = (Double) entity.getProperty("charge");
	this.beforeArrival = (Long) entity.getProperty("beforeArrival");
	this.avalible = (Boolean) entity.getProperty("avalible");
	this.status = (Boolean) entity.getProperty("status");

	this.key = entity.getKey();
	
}

public void LoadData() {
	if (this.id > -1) {
		Entity entity = LoadData(EntityName.BookingPolicy, this.id);
		setEntity(entity);
	}
}
 
}

